package com.koala.data;

import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;

public class Linkman implements Comparable{
	private String phone;
	private String name;
	private String companyName;
	private String department;
	private String job;
	private String location;
	
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getCompanyName() {
		return companyName;
	}
	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}
	public String getDepartment() {
		return department;
	}
	public void setDepartment(String department) {
		this.department = department;
	}
	public String getJob() {
		return job;
	}
	public void setJob(String job) {
		this.job = job;
	}
	public String getLocation() {
		return location;
	}
	public void setLocation(String location) {
		this.location = location;
	}
	
	@Override
	public int compareTo(Object another) {
		String thisName = getName() ,anotherName = ((Linkman)another).getName() ;
		try {
			 thisName = ChineseToPinYin.getPinYinFromString(getName());
			 anotherName = ChineseToPinYin.getPinYinFromString(((Linkman)another).getName());
		} catch (BadHanyuPinyinOutputFormatCombination e) {
			e.printStackTrace();
		}
		
		int result =thisName.compareTo(anotherName) ;
		System.out.println("name : " + thisName + "  compareName : " 
		+ anotherName + "  result : " + result);
		return  result ;
	}
	
	 
}
